package com.jindy.module.oaContractApply.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jindy.common.annotation.Log;
import com.jindy.common.core.controller.BaseController;
import com.jindy.common.core.domain.AjaxResult;
import com.jindy.common.enums.BusinessType;
import com.jindy.module.oaContractApply.domain.SyContractInfoWe;
import com.jindy.module.oaContractApply.service.ISyContractInfoWeService;
import com.jindy.common.utils.poi.ExcelUtil;
import com.jindy.common.core.page.TableDataInfo;

/**
 * 我方合同信息Controller
 * 
 * @author jindy
 * @date 2023-06-29
 */
@RestController
@RequestMapping("/module/SyContractInfoWe")
public class SyContractInfoWeController extends BaseController
{
    @Autowired
    private ISyContractInfoWeService syContractInfoWeService;

    /**
     * 查询我方合同信息列表
     */
    @PreAuthorize("@ss.hasPermi('module:SyContractInfoWe:list')")
    @GetMapping("/list")
    public TableDataInfo list(SyContractInfoWe syContractInfoWe)
    {
        startPage();
        List<SyContractInfoWe> list = syContractInfoWeService.selectSyContractInfoWeList(syContractInfoWe);
        return getDataTable(list);
    }

    /**
     * 导出我方合同信息列表
     */
    @PreAuthorize("@ss.hasPermi('module:SyContractInfoWe:export')")
    @Log(title = "我方合同信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SyContractInfoWe syContractInfoWe)
    {
        List<SyContractInfoWe> list = syContractInfoWeService.selectSyContractInfoWeList(syContractInfoWe);
        ExcelUtil<SyContractInfoWe> util = new ExcelUtil<SyContractInfoWe>(SyContractInfoWe.class);
        util.exportExcel(response, list, "我方合同信息数据");
    }

    /**
     * 获取我方合同信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('module:SyContractInfoWe:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(syContractInfoWeService.selectSyContractInfoWeById(id));
    }

    /**
     * 新增我方合同信息
     */
    @PreAuthorize("@ss.hasPermi('module:SyContractInfoWe:add')")
    @Log(title = "我方合同信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SyContractInfoWe syContractInfoWe)
    {
        return toAjax(syContractInfoWeService.insertSyContractInfoWe(syContractInfoWe));
    }

    /**
     * 修改我方合同信息
     */
    @PreAuthorize("@ss.hasPermi('module:SyContractInfoWe:edit')")
    @Log(title = "我方合同信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SyContractInfoWe syContractInfoWe)
    {
        return toAjax(syContractInfoWeService.updateSyContractInfoWe(syContractInfoWe));
    }

    /**
     * 删除我方合同信息
     */
    @PreAuthorize("@ss.hasPermi('module:SyContractInfoWe:remove')")
    @Log(title = "我方合同信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(syContractInfoWeService.deleteSyContractInfoWeByIds(ids));
    }
}
